import request from '@/utils/request';
import { AccountForm, AccountQuery } from './types';
import { AxiosResponse } from 'axios';
// 查询科目列表
export function listAccount(query?: AccountQuery): Promise<AxiosResponse> {
  return request({
    url: '/system/account/list',
    method: 'get',
    params: query
  });
}

// 查询科目列表（排除节点）
export function listAccountExcludeChild(accountId: string) {
  return request({
    url: '/system/account/list/exclude/' + accountId,
    method: 'get'
  });
}

// 查询科目详细
export function getAccount(accountId: string) {
  return request({
    url: '/system/account/' + accountId,
    method: 'get'
  });
}

// 新增科目
export function addAccount(data: AccountForm) {
  return request({
    url: '/system/account',
    method: 'post',
    data: data
  });
}

// 修改科目
export function updateAccount(data: AccountForm) {
  return request({
    url: '/system/account',
    method: 'put',
    data: data
  });
}

// 删除科目
export function delAccount(accountId: string) {
  return request({
    url: '/system/account/' + accountId,
    method: 'delete'
  });
}
